/*
 * premodeISCPpacket.java
 *
 * Created on January 22, 2007, 8:07 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package net.sf.iSnake.core;

import java.io.Serializable;
import java.util.Vector;

/**
 *
 * @author Jitendra
 *
 * The object of this class will wrap the messages that is required to be sent in PRE MODE
 * [ R ]    -> Receives from server
 * [ S ]    -> Send to server
 * [ S/R ]  -> Can be both SEND / RECEIVED from and to server
 *
 */

public class premodeISCPpacket implements Serializable {
    private Short premodeCommand;                            // Command that specifies the type of data contained in this packet
    
    private PlayerPreferences localPlayerPereference;        // The preferences (name,location.color,etc) of local player [ S ]
    
    private Short chatMessageSenderId;                       // Sender Player id for Chat messages   [ S/R ]
    private Short chatMessageReceiverId;                     // Receiver Player id for Chat messages [ S/R ]
    private String chatMessage;                              // Actual Chat message                  [ S/R ]
    
    private String errorMessage;                             // Error message if some error has occured
    private Short errorCode;                                 // Error code specifying if some error has occured

    private Short gameSpeed;                                 // Speed of game    [ R ]
    
    private Vector remotePlayerPreference;                  // Information about players joining the game [ R ]
    
    private Vector wallCoordinates;                         // contains objects of type GameAreaCoordin which indicate the walls
    private Vector snakeStartPosition;                      // Starting position (initial position) of snake    [ R ]    
    
    public premodeISCPpacket() {
        clearAllMembers();
    }
    
    public premodeISCPpacket(Short premodeCommand) {
        clearAllMembers();
        this.setPremodeCommand(premodeCommand);
    }
    
    public void clearAllMembers()   {
        this.premodeCommand = 0;
        this.localPlayerPereference = null;
        this.setChatMessageSenderId(null);
        this.setChatMessageReceiverId(null);
        this.setChatMessage(null);
        
        this.errorCode = 0;
        this.errorMessage = null;
        
        this.setSnakeStartPosition(null);
        this.gameSpeed = null;
        
        this.remotePlayerPreference = null;
    }
    
    public Short getPremodeCommand() {
        return premodeCommand;
    }
    
    public void setPremodeCommand(Short premodeCommand) {
        clearAllMembers();
        this.premodeCommand = premodeCommand;
    }
    
    public PlayerPreferences getLocalPlayerPereference() {
        return localPlayerPereference;
    }
    
    public void setLocalPlayerPereference(PlayerPreferences localPlayerPereference) {
        this.localPlayerPereference = localPlayerPereference;
    }
    
    public Short getChatMessageSenderId() {
        return chatMessageSenderId;
    }
    
    public void setChatMessageSenderId(Short chatMessageSenderId) {
        this.chatMessageSenderId = chatMessageSenderId;
    }
    
    public Short getChatMessageReceiverId() {
        return chatMessageReceiverId;
    }
    
    public void setChatMessageReceiverId(Short chatMessageReceiverId) {
        this.chatMessageReceiverId = chatMessageReceiverId;
    }
    
    public String getChatMessage() {
        return chatMessage;
    }
    
    public void setChatMessage(String chatMessage) {
        this.chatMessage = chatMessage;
    }
    
    public Short getGameSpeed() {
        return gameSpeed;
    }
    
    public void setGameSpeed(Short gameSpeed) {
        this.gameSpeed = gameSpeed;
    }
    
    public Vector getRemotePlayerPreference() {
        return remotePlayerPreference;
    }
    
    public void setRemotePlayerPreference(Vector remotePlayerPreference) {
        this.remotePlayerPreference = remotePlayerPreference;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public Short getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Short errorCode) {
        this.errorCode = errorCode;
    }

    public Vector getWallCoordinates() {
        return wallCoordinates;
    }

    public void setWallCoordinates(Vector wallCoordinates) {
        this.wallCoordinates = wallCoordinates;
    }

    public Vector getSnakeStartPosition() {
        return snakeStartPosition;
    }

    public void setSnakeStartPosition(Vector snakeStartPosition) {
        this.snakeStartPosition = snakeStartPosition;
    }
}